using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace OpenFlashChartLib
{
    public class KeyValuePair : RenderBase
    {
        private string _key;
        private string _value;

        public KeyValuePair(string key, string value)
        {
            _value = value;
            _key = key;
        }

        public KeyValuePair(string key)
        {
            _key = key;
        }

        public string Value
        {
            get { return _value; }
            set { _value = value; }
        }

        public string Key
        {
            get { return _key; }
            set { _key = value; }
        }

        public override void RenderContent(HtmlTextWriter writer)
        {
            writer.Write(_key);
            writer.Write("=");
            writer.Write(Util.ToSafeString(_value));
        }

        public override void Render(HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(_key) || string.IsNullOrEmpty(_value))
                return;
            base.Render(writer);
        }
    }
}
